package main

import "fmt"

//结构体指针类型

type Person struct {
	name string
	sex byte
	age int
}

type Student struct {
	*Person
	id int
	addr string
}

func main() {
	s1 := Student{&Person{"mike", 'm', 18}, 1, "bj"}
	fmt.Printf("%+v\n", s1)
	fmt.Printf("%s, %c, %d\n", s1.name,s1.sex, s1.age)

	//声明变量
	var s2 Student
	s2.Person = new(Person)
	s2.name = "yoyo"
	s2.sex = 'f'
	s2.age = 20

	s2.id = 2
	s2.addr = "sz"
	fmt.Println(s2.name, s2.sex, s2.age, s2.id, s2.age)
}